package com.wantup.springboot.boot.interceptor;

import com.wantup.springboot.boot.beans.User;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 2018/11/14 18:00
 */
public class LoginInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        System.out.println("我是拦截器 -----  preHandle  ");
//        User user = (User) request.getSession().getAttribute("user");
//        if (user!=null){
//            return true;
//        }
//        response.sendRedirect(request.getContextPath()+"/index");
        return true;
    }
}
